package com.lzx.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.validation.Valid;

/**
 * @Author: lzx
 * @Date: 2021/3/1 17:16
 */
@Configuration
public class MyMvcConfig  implements WebMvcConfigurer {
    @Value("${upload.path}")
    private String path;
    @Value("${upload.staticPath}")
    private String staticPath;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(staticPath).addResourceLocations("file:"+path);
    }
}
